import cv2 as cv

# 创建第一个视觉程序“Hello，world！”，显示Lena图片。
filename = r'C:\Users\lenovo\Desktop\text\csdn\lena.jpg'
img1 = cv.imread(filename)
img = cv.pyrDown(img1)
cv.imshow("Hello,World!",img)
cv.waitKey()

# 对Lena图像，分解得到HSV分量，显示各分量
hsv = cv.cvtColor(img,cv.COLOR_BGR2HSV)
cv.imshow("Hue",hsv[:,:,0])
cv.imshow("Saturation",hsv[:,:,1])
cv.imshow("Value",hsv[:,:,2])
cv.waitKey()

# 对Lena图像，分解得到RGB分量，显示各分量
rgb = cv.cvtColor(img,cv.COLOR_BGR2RGB)
cv.imshow("Red",rgb[:,:,0])
cv.imshow("Green",rgb[:,:,1])
cv.imshow("Blue",rgb[:,:,2])
cv.waitKey()

cv.destroyAllWindows()